<?php

class UsersTableSeeder extends Seeder {

    public function run()
    {
        DB::table('permission_role')->delete();
        DB::table('assigned_roles')->delete();
        DB::table('permissions')->delete();
        DB::table('roles')->delete();
        DB::table('users')->delete();

        $users = array(
            array(
                'id' => 1,
                'username'      => 'admin',
                'email'      => 'admin@orderMeal.com',
                'password'   => Hash::make('1234'),
                'confirmed'   => 1,
                'confirmation_code' => md5(microtime().Config::get('app.key')),
                'created_at' => new DateTime,
                'updated_at' => new DateTime,
                'attach_type'=>'Staff',
                'attach_id'  =>1
            ),
            array(
                'id' => 2,
                'username'      => 'zhangsan',
                'email'      => 'zhangsan@orderMeal.com',
                'password'   => Hash::make('1234'),
                'confirmed'   => 1,
                'confirmation_code' => md5(microtime().Config::get('app.key')),
                'created_at' => new DateTime,
                'updated_at' => new DateTime,
                'attach_type'=>'Member',
                'attach_id'  =>1
            ),
            array(
                'id' => 3,
                'username'      => 'lisi',
                'email'      => 'lisi@orderMeal.com',
                'password'   => Hash::make('1234'),
                'confirmed'   => 1,
                'confirmation_code' => md5(microtime().Config::get('app.key')),
                'created_at' => new DateTime,
                'updated_at' => new DateTime,
                'attach_type'=>'Member',
                'attach_id'  =>2
            ),
            array(
                'id' => 4,
                'username'      => 'wanger',
                'email'      => 'wanger@orderMeal.com',
                'password'   => Hash::make('1234'),
                'confirmed'   => 1,
                'confirmation_code' => md5(microtime().Config::get('app.key')),
                'created_at' => new DateTime,
                'updated_at' => new DateTime,
                'attach_type'=>'Member',
                'attach_id'  =>3
            ),
        );

        DB::table('users')->insert( $users );

    }

}
